-
Notifications
You must be signed in to change notification settings - Fork 254
SUBMARINE-598. Support get environment list from database #374
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kobe860219 for the contribution.
...r/server-core/src/main/resources/org/apache/submarine/database/mappers/EnvironmentMapper.xml
Outdated
Show resolved
Hide resolved
...er/server-core/src/main/java/org/apache/submarine/server/environment/EnvironmentManager.java
Outdated
Show resolved
Hide resolved
...er/server-core/src/main/java/org/apache/submarine/server/environment/EnvironmentManager.java
Outdated
Show resolved
Hide resolved
...er/server-core/src/main/java/org/apache/submarine/server/environment/EnvironmentManager.java
Outdated
Show resolved
Hide resolved
...er/server-core/src/main/java/org/apache/submarine/server/environment/EnvironmentManager.java
Show resolved
Hide resolved
...er/server-core/src/main/java/org/apache/submarine/server/environment/EnvironmentManager.java
Outdated
Show resolved
Hide resolved
return environmentList; | ||
|
||
if (envs.size() != 0) { | ||
return envs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If direct return envs, Will this cause envs
variable to never update?
content = @Content( | ||
schema = @Schema( | ||
implementation = Environment.class)))}) | ||
public Response listAllEnvironments() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a listEnvironment
in EnvironmentRestApi.java
, why create a new function listAllEnvironments
?
Lines 151 to 159 in cc9dde5
public Response listEnvironment(@QueryParam("status") String status) { | |
try { | |
List<Environment> environmentList = | |
environmentManager.listEnvironments(status); | |
return new JsonResponse.Builder<List<Environment>>(Response.Status.OK) | |
.success(true).result(environmentList).build(); | |
} catch (SubmarineRuntimeException e) { | |
return parseEnvironmentServiceException(e); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
listEnvironment
just get those environments in cache. listAllEnvironments
will get environments from database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can merge it rather than create new.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will merge it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kobe860219 Thanks for working on this. Even from API end point perspective, I don't see a need for "list". Just typing "/v1/environment" should return the list of environments. Change is required only in model layer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jiwq @pingsutw @manirajv06 I have updated this pr. Please take a look, Thanks :))
@kobe860219 Could you fix the failed tests: |
@jiwq I have fixed the failed tests :) |
+1 Will commit if no more comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What is this PR for?
Improve environment swagger api.
When cache is null. Will get environment data from database.
What type of PR is it?
[Improvement]
Todos
What is the Jira issue?
https://issues.apache.org/jira/browse/SUBMARINE-598
How should this be tested?
https://travis-ci.org/github/kobe860219/submarine/builds/716904008?utm_source=github_status&utm_medium=notification
Screenshots (if appropriate)
Questions: